package com.jeesite.modules.dataScreen.web;

import com.jeesite.modules.dataScreen.domain.monitoring.RankVO;
import com.jeesite.modules.dataScreen.entity.Unefforder;
import com.jeesite.modules.dataScreen.service.CitizenOpinionService;
import com.jeesite.modules.dataScreen.service.UnefforderService;
import com.jeesite.modules.dataScreen.web.vo.Result;
import com.jeesite.modules.dataScreen.web.vo.citizenopinion.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author machenzhi
 * @date 2024/06/28 17:22
 */
@RestController
@Api(tags = "民情民意模块")
@RequestMapping("/citizenOpinion")
public class CitizenOpinionApi {

    @Autowired
    private CitizenOpinionService citizenOpinionService;

    @Autowired
    private UnefforderService unefforderService;


    @ApiOperation("更新频率为1分钟的数据")
    @GetMapping("/oneMinInfo")
    public Result<CitizenOpinionOneMinVo> getOneMinCitizenOpinion() {
        return Result.OK(citizenOpinionService.getOneMinCitizenOpinion());
    }


    @ApiOperation("更新频率为5分钟的数据")
    @GetMapping("/fiveMinInfo")
    public Result<CitizenOpinionFiveMinVo> getFiveMinCitizenOpinion() {
        return Result.OK(citizenOpinionService.getFiveMinCitizenOpinion());

    }


    @ApiOperation("更新频率为一小时的数据")
    @GetMapping("/hourInfo")
    public Result<CitizenOpinionHourVo> getHourCitizenOpinion() {
        return Result.OK(citizenOpinionService.getHourCitizenOpinion());
    }

    @ApiOperation("更新频率为一天的数据")
    @GetMapping("/dayInfo")
    public Result<CitizenOpinionDayVo> getDayCitizenOpinion() {
        return Result.OK(citizenOpinionService.getDayCitizenOpinion());

    }


    @ApiOperation("低效率工单列表")
    @GetMapping("/listOrder")
    public Result<List<Unefforder>> listCitizenOrderInfo(@ApiParam(value = "类型 1：已办结  2：未办结", required = true) Integer type) {
        return Result.OK(unefforderService.listByType(type));
    }


    @ApiOperation("低效率工单详情")
    @GetMapping("/getOrderById")
    public Result<Unefforder> getOrderById(@ApiParam(value = "工单编号", required = true) String workorderid) {
        return Result.OK(unefforderService.getOrderById(workorderid));
    }



    @ApiOperation("7日工单走势")
    @GetMapping("/orderCountTrend")
    public Result<List<RankVO>> orderNumTrend() {
        return Result.OK(citizenOpinionService.orderNumTrend());
    }
}
